1.5.4 Run parts of a script
It is possible to execute only parts of a script. This may be done in three ways:
A) Mark out individual lines by defining them as help-text/comments
- Enter the characters
//
in front of the relevant lines you want to keep out. The system interprets everything that comes behind//
as help-text/comments, and it will therefore be skipped from the execution
-
In the next steps, the help-text marking may be removed gradually for more and more command lines until the entire script is completely executed. Note that the command lines previously executed are kept in the memory and will not be rerun. Only those lines where the
//
characters are removed will actually be rerun -
You may also automatically add
//
in front of several lines by marking them and using the hotkey combination ALT + C. By repeating the procedure for the exact same lines, all//
signs will be removed
B) Selecting larger parts of a script by defining blocks as help-text
-
Enter the keywords
textblock
andendblock
before and after a block of command respectively. Everything in between will then be kept out of the execution. Note that the purpose oftextblock
andendblock
is to enter comments for analyses performed in the command window. The command window can therefore be filled up with the command lines that were defined as comments in the script, and it may look a bit messy. But as fewer and fewer lines are kept out from the execution, the command window will gradually contain less of this -
The advantage of
textblock
andendblock
is that it is less time consuming if the number of lines to be marked out is extensive -
Just like using the characters
//
, the system will "remember" what has been run previously and will jump right down to the part of the script where the "text block mark" has been removed. Note that this does not apply when the textblock-functionality has been used on the preliminary parts of the script
Example: Using textblocks in scripts
C) Click on a line number in your script and then press "Kjør" ("Execute") or "Send til kommandolinjen" ("Execute and send result to command window").
This will run through all the lines in your script until the line that was marked, and stop the execution there. You may use this procedure to run through gradually more and more of your script if you are not ready to run through it completely.
Example: Click on line number to run through all lines until this point (and not the complete script)